<template>
  <div class="app-container">
    <!-- 查询模块 -->
    <div class="formDiv">
      <el-form ref="form"  :inline="true" label-width="130px">
        <el-row>
          <el-col :span="6">
            <el-form-item label="流水单号">
              <el-input v-model="params.orderSn" placeholder="请输入流水单号" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="用户姓名">
              <el-input v-model="params.userName" placeholder="请输入用户姓名" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="手机号">
              <el-input v-model="params.phoneNum" placeholder="请输入用户手机号" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="审核状态">
              <el-select v-model="params.img6Handle">
                <el-option label="全部" :value="0" />
                <el-option label="待审核" :value="1" />
                <el-option label="审核通过" :value="2" />
                <el-option label="审核驳回" :value="3" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="上传时间" width="236">
              <el-date-picker
                v-model="time"
                type="daterange"
                value-format="yyyy-MM-dd HH:mm:ss"
                range-separator="-"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :default-time="['00:00:00', '23:59:59']"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="审核时间" width="236">
              <el-date-picker
                v-model="time1"
                type="daterange"
                value-format="yyyy-MM-dd HH:mm:ss"
                range-separator="-"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
                :default-time="['00:00:00', '23:59:59']"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-button style="margin-left:60px" type="primary" @click="searchfun">查询</el-button>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <!-- table -->
    <div class="table">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column
          type="index"
          label="序号"
          fixed="left"
          align="center"
          :index="table_index"
          width="50"
        />
        <el-table-column prop="orderSn" align="center" label="流水单号" />
        <!-- <el-table-column prop="userInfo" align="center" label="用户信息" /> -->
        <el-table-column prop="userInfo" align="center" label="用户信息" width="120px">
          <template slot-scope="scope">
            <p>{{scope.row.userName}}</p>
            <p>{{scope.row.userPhone| phonereg}}</p>
          </template>
        </el-table-column>
        <el-table-column prop="hospitalName" align="center" label="医院信息" />
        <el-table-column prop="projectName" align="center" label="项目信息" />
        <el-table-column prop="totalMoney" align="center" label="消费金额" />
        <el-table-column prop="applyMoney" align="center" label="补贴金额" />
        <el-table-column prop="teamName" align="center" label="团队" />
        <!-- <el-table-column prop="serviceInfo" align="center" label="服务商信息" /> -->
        <el-table-column prop="serviceInfo" align="center" label="服务商信息" width="120px">
          <template slot-scope="scope">
            <p>{{scope.row.serviceName}}</p>
            <p>{{scope.row.servicePhone| phonereg}}</p>
          </template>
        </el-table-column>
        <el-table-column prop="img6UploadTimeStr" align="center" label="上传时间" />
        <el-table-column prop="waterButlerPhone" align="center" label="流水单管家">
          <template slot-scope="scope">
            <div>
              <p>{{scope.row.waterButlerName}}</p>
              <p>{{scope.row.waterButlerPhone| phonereg}}</p>
            </div>
          </template>
        </el-table-column>
        <!-- <el-table-column prop="allowanceButler" align="center" label="补贴单管家" /> -->
        <el-table-column prop="allowanceButler" align="center" label="补贴单管家" width="120px">
          <template slot-scope="scope">
            <p>{{scope.row.allowanceButlerName}}</p>
            <p>{{scope.row.allowanceButlerPhone| phonereg}}</p>
          </template>
        </el-table-column>
        <el-table-column prop="handleTimeStr" align="center" label="审核时间" />
        <el-table-column prop="img6Handle" align="center" label="审核状态">
          <template slot-scope="scope">
            <div>
              <span v-if="scope.row.img6Handle==1">待审核</span>
              <span v-if="scope.row.img6Handle==2">审核通过</span>
              <span v-if="scope.row.img6Handle==3">审核驳回</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="uploadRemark" align="center" label="失败原因" />
        <el-table-column prop="name" align="center" label="操作">
          <template slot-scope="scope">
            <div v-if="scope.row.img6Handle==1">
              <el-button
                v-if="permissionJson.indexOf('AdminPictureReviewProvider.update')"
                type="text"
                @click="deit(scope.row)"
              >审核</el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="block" style="margin: 40px 0;">
      <el-pagination
        :current-page="params.pageNum"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="params.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
  </div>
</template>
<script>
import pictureaudit from "@/api/pictureaudit/pictureaudit";
export default {
  name: "Pictureaudit",
  data() {
    return {
      permissionJson: JSON.parse(localStorage.getItem("permissionJson")),
      params: {
        pageNum: 1,
        orderSn: "",
        userName: "",
        phoneNum: "",
        img6Handle: 0,
        img6UploadStartTime: "",
        img6UploadEndTime: "",
        handleStartTime: "",
        handleEndTime: "",
        pageSize: 20
      },
      tableData: [{ number: 100 }],
      total: 0,
      time: "",
      time1: ""
    };
  },
  watch: {
    time(val) {
      this.params.img6UploadStartTime = val ? val[0] : "";
      this.params.img6UploadEndTime = val ? val[1] : "";
    },
    time1(val) {
      this.params.handleStartTime = val ? val[0] : "";
      this.params.handleEndTime = val ? val[1] : "";
    }
  },
  created() {
    this.list();
  },
  methods: {
    deit(data) {
      this.$router.push({ name: "auditedit", query: { id: data.id } });
    },
    table_index(index) {
      return (this.params.pageNum - 1) * this.params.pageSize + index + 1;
    },
    searchfun() {
      this.params.pageNum = 1;
      this.list();
    },
    list() {
      pictureaudit.list(this.params).then(res => {
        console.log(res);
        if (res.data.code == 0) {
          this.tableData = res.data.data.list;
          this.total = res.data.data.count;
        } else {
          this.$message.error(res.data.msg);
        }
      });
    },
    handleSizeChange(val) {
      this.params.pageNum = 1;
      this.params.pageSize = val;
      this.list();
    },
    handleCurrentChange(val) {
      this.params.pageNum = val;
      this.list();
    }
  }
};
</script>
<style scoped>
/* 分页 */
.pagesCon {
  height: 40px;
  margin-top: 20px;
}
.pagesCon > div {
  float: right;
}
/* 表单样式修改 */
.el-range-editor--medium.el-input__inner {
  width: 236px;
}
</style>
